package com.xx.happychatboot.middleware.minio.controller;

import com.xx.happychatboot.base.vo.response.ResponseDate;
import com.xx.happychatboot.middleware.minio.service.MinIoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

@Controller
public class MinIoController {
    @Autowired
    private MinIoService minIoService;

    /**
     * 上传头像
     * @param file
     * @return
     */
    @PostMapping(value = "/avatarFile")
    @ResponseBody
    public ResponseDate uploadAvatar(@RequestPart("file") MultipartFile file) throws Exception {
        return minIoService.uploadAvatar(file);
    }
}
